﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes {
    import flash.display.*;
    import Engine.Helpers.*;
    import Engine.*;

    public class TrainTracks extends MapResource {

        private const TRAIN_TRACKS:String = "trainTracks";
        protected const STATE_STATIC:String = "static";

        protected var m_sprite:Sprite = null;
        protected var m_bitmap:Bitmap = null;
        protected var m_savImageClass:ItemImageInstance = null;

        public function TrainTracks(_arg1:String){
            super(_arg1);
            m_objectType = WorldObjectTypes.TRAIN_STATION;
            setState(this.STATE_STATIC);
            m_typeName = this.TRAIN_TRACKS;
            m_ownable = false;
        }
        override public function loadObject(_arg1:Object):void{
            super.loadObject(_arg1);
        }
        override protected function getLayerName():String{
            return ("road");
        }
        override public function isSellable():Boolean{
            return (false);
        }
        override public function canBeDragged():Boolean{
            return (false);
        }
        override public function drawDisplayObject():void{
            var _local2:int;
            var _local3:Vector2;
            var _local4:int;
            var _local5:int;
            var _local6:Bitmap;
            super.drawDisplayObject();
            var _local1:Bitmap = (m_itemImage as Bitmap);
            if (((_local1) && ((this.m_sprite == null)))){
                this.m_bitmap = _local1;
                this.m_sprite = new Sprite();
                this.m_sprite.addChild(m_itemImage);
                m_itemImage.x = 0;
                m_itemImage.y = 0;
                _local2 = m_itemImage.width;
                if (m_item.sizeX > m_item.sizeY){
                    _local3 = IsoMath.getPixelDeltaFromTileDelta(m_item.sizeY, 0);
                    _local4 = (m_item.sizeX / m_item.sizeY);
                } else {
                    _local3 = IsoMath.getPixelDeltaFromTileDelta(0, m_item.sizeX);
                    _local4 = (m_item.sizeY / m_item.sizeX);
                };
                _local3.x = (_local3.x / m_displayObject.scaleX);
                _local3.y = (_local3.y / m_displayObject.scaleY);
                _local5 = 1;
                while (_local5 < _local4) {
                    _local6 = new Bitmap(_local1.bitmapData, "auto", true);
                    _local6.x = (_local3.x * _local5);
                    _local6.y = (_local3.y * _local5);
                    this.m_sprite.addChild(_local6);
                    _local5++;
                };
                replaceContent(this.m_sprite);
            };
        }
        override protected function adjustSize(_arg1:Vector3):void{
            if (_arg1.x > _arg1.y){
                _arg1.x = _arg1.y;
            } else {
                _arg1.y = _arg1.x;
            };
        }
        override public function getDepthPriority():Number{
            return (-1);
        }
        override public function updateDisplayObjectTransform():void{
            if (m_imageClass != null){
                this.m_savImageClass = m_imageClass;
            };
            var _local1:Boolean;
            if (m_imageClass == null){
                _local1 = true;
                m_imageClass = this.m_savImageClass;
            };
            super.updateDisplayObjectTransform();
            if (_local1){
                m_imageClass = null;
            };
        }

    }
}//package Classes 
